<template>
	<el-drawer title="大事记详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="事记标题" prop="title">{{form.title}}
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="事记类型" prop="eventType">{{form.typeName}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="事件日期" prop="happenTime">{{form.happenTime}}</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="事件图片">
						<el-image v-for="(url,index) in form.mainPic.split(',')" :key="index" :src="url" style="width: 100px;height: 100px;margin-left: 10px;"></el-image>
					</el-form-item>
					<el-form-item label="事件摘要">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="相关附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu,
	},
	data() {
		return {
			loading: false,
			form: {
				recordId: '',
				title: '',
				eventType: '',
				happenTime: '',
				typeName:'',
				mainPic: '',
				content: '',
				attachId: ''
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model){
			this.model=model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data){
			this.form.recordId = data.recordId
			this.form.title = data.title
			this.form.eventType = data.eventType
			this.form.typeName = data.typeName
			this.form.happenTime = data.happenTime
			this.form.mainPic = data.mainPic
			this.form.content = data.content
			this.form.attachId = data.attachId
		},
	}
}
</script>

<style>
</style>
